package vmodel

import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import remote.domain.Coffee
import remote.domain.Ok
import remote.Remote
import androidx.compose.runtime.*

//class CoffeeModel : ViewModel() {
//    private var _ok = MutableLiveData(listOf<Ok>())
//    val ok: LiveData<List<Ok>> = _ok
//
//    private var _coffees = MutableLiveData(listOf<Coffee>())
//    val coffees: LiveData<List<Coffee>> = _coffees
//
//    fun getOk() {
//        Remote.service.ok().enqueue(object : Callback<List<Ok>> {
//
//            override fun onResponse(call: Call<List<Ok>>, response: Response<List<Ok>>) {
//                response.body()?.let { it ->
//                    _ok.value = it.toMutableList()
//                }
//            }
//
//            override fun onFailure(call: Call<List<Ok>>, t: Throwable) {
//                t.printStackTrace()
//            }
//        })
//    }
//
//    fun getCoffee() {
//        Remote.service.query(id = 1)
//            .enqueue(object : Callback<Coffee> {
//
//                override fun onResponse(call: Call<Coffee>, response: Response<Coffee>) {
//                    response.body()?.let { it ->
//                        _coffees.value = mutableListOf(it)
//                    }
//                }
//
//                override fun onFailure(call: Call<Coffee>, t: Throwable) {
//                    t.printStackTrace()
//                }
//            })
//    }
//}